<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <h1>Date对象</h1>
    <script>
        // 得到当前时间
        var today = new Date();
        console.log(today);
        // 指定时间
        // var today = new Date(2019, 9, 25, 12, 12, 12, 12);
        // var today = new Date("2019-10-25 12:12:12");


        console.log("year:"+today.getFullYear());
        console.log("month:" + (today.getMonth() + 1));
        console.log(`现在是${today.getMonth() + 1}月`)
        // 月份是0-11，所以要加1
        console.log("date:"+today.getDate());
        console.log("hours:"+today.getHours());
        console.log("minutes:"+today.getMinutes());
        console.log("seconds:"+today.getSeconds());
        console.log("milliseconds:"+today.getMilliseconds());
        
        console.log("day:"+today.getDay());
        console.log("time:"+today.getTime());

        console.log(today.getUTCHours())
        console.log(today.getUTCMinutes())
        console.log(today.getUTCSeconds())
        console.log(today.getUTCMilliseconds())

    </script>
</body>
</html>